package com.user.controller;

import com.user.dao.seat.GetSeatTime;
import com.user.dao.seat.SeatDao;
import com.user.service.SeatsService;
import com.user.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : Yu
 * @Date 2024/3/9 13:42
 */
@RestController
@RequestMapping("/seat")
public class SeatsController {

    @Autowired
    SeatsService seatService;

    /**
     * 获取餐厅座位
     *
     * @param seat 餐厅
     * @return 座位信息
     */
    @PostMapping("/getSeatList")
    public R getSeatByTime(@RequestBody GetSeatTime seat) {
        return seatService.getSeat(seat);
    }


    /**
     * 创建修改餐厅座位
     *
     * @param seat 座位信息
     * @return 创建结果
     */
    @PostMapping("/createSeat")
    public R getSeat(@RequestBody SeatDao seat) {
        return seatService.createSeat(seat);
    }

    /**
     * 获取餐厅座位
     *
     * @param seat 餐厅
     * @return 座位信息
     */
    @GetMapping("/getSeat")
    public R getSeatList(@RequestParam Integer restaurantId) {
        return seatService.getSeatList(restaurantId);
    }

    @GetMapping("/updateStatus")
    public R updateStatus(@RequestParam Integer seatId) {
        return seatService.updateStatus(seatId);
    }

    @DeleteMapping("/deleteSeat")
    public R deleteSeat(@RequestParam Integer seatId) {
        return seatService.deleteSeat(seatId);
    }

    @GetMapping("/getIdleSeats")
    public R getIdleSeats(@RequestParam Integer restaurantId) {
        return seatService.getIdleSeats(restaurantId);
    }

    @GetMapping("/getSeatTotal")
    public R getSeatTotal(@RequestParam Integer restaurantId) {
        return seatService.getSeatTotal(restaurantId);
    }

}
